<?php
namespace app\admin\validate;
use think\Validate;
class User extends Validate{
	protected $rule=[
		["name","require","姓名必填"],
	    ["idcard","require|checkIdcard|unique:user","证件号必填|证件号格式有误|证件号已存在"],
		['phone',"require|length:11|unique:user","手机号必填|手机号格式有误|手机号已存在"]
	];

	protected $scene=[
		'add'=>['name','idcard','phone']
	];
	protected function checkIdcard($value){
		return strlen($value)==15||strlen($value)==18;
	}
}